﻿<UserControl x:Class="Dhgms.Whipstaff.Views.Controls.AccordianExpanderControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <ListBox>
            <ListBox.Resources>
                <Style TargetType="{x:Type Expander}">
                    <Setter Property="IsExpanded" Value="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"/>
                </Style>
            </ListBox.Resources>
            <ListBox.Template>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <ItemsPresenter/>
                </ControlTemplate>
            </ListBox.Template>
            <ListBox.ItemContainerStyle>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <ContentPresenter Content="{TemplateBinding Content}"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
            <Expander Header="Expander1">
                <StackPanel>
                    <RadioButton Content="Eat Me" GroupName="Two"/>
                    <RadioButton Content="Eat Pork" GroupName="Two"/>
                    <RadioButton Content="Eat at Joe's" GroupName="Two"/>
                </StackPanel>
            </Expander>
            <Expander Header="Expander2">
                <StackPanel>
                    <RadioButton Content="Pork" GroupName="Two"/>
                    <RadioButton Content="Beef" GroupName="Two"/>
                    <RadioButton Content="Chicken" GroupName="Two"/>
                </StackPanel>
            </Expander>
            <Expander Header="Expander3">
                <StackPanel>
                    <RadioButton Content="Grill" GroupName="Two"/>
                    <RadioButton Content="Bake" GroupName="Two"/>
                    <RadioButton Content="Fry" GroupName="Two"/>
                </StackPanel>
            </Expander>
        </ListBox>
    </Grid>
</UserControl>